<%@page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.exam.util.Tools"%>
<%@page import="com.exam.model.PaperModel"%>
<%@page import="com.exam.dao.PaperDao"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>
<jsp:include page="checkAdmin.jsp" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<link href="css/style.css" rel="stylesheet" type="text/css" /> 
<script type="text/javascript" src="js/jquery-2.0.js"></script>

	<style>
		h3{ font-size:14px; margin:0px; border-bottom:solid 2px #cde; margin-top:20px; color:#333}
		.ilist{ margin:0px; list-style:none; margin-bottom:10px}
		.ilist li{ padding:5px 5px 5px 10px; border-bottom: dotted 1px #cde }
		.ilist li em{ margin-left:10px; color:#888}
		.ilist li span{ margin:0 5px; padding:5px}
	</style>
	
</head>

<script type="text/javascript">
$(document).ready(function(e){
  var url = "#";
  $(".click").click(function(){
  		$(".tip").fadeIn(200);
  		url = this.href;
  		return false;
  });
  
  $(".tiptop a").click(function(){
 		 $(".tip").fadeOut(200);
	});

  $(".sure").click(function(){
  		$(".tip").fadeOut(100);
  		location.href = url;
	});

  $(".cancel").click(function(){
 		$(".tip").fadeOut(100);
	});
	
});


</script>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    </ul>
    </div>
    
    <div class="mainindex">
    
	<h3>进行中的考试</h3>
	
	<ul class="ilist" id="ul_currentexam">
	 <%
	  PaperDao  pdao = new PaperDao();
	  PaperModel  currentExam = pdao.getTestPaper(); 
	  if(currentExam!=null){
	  if(application.getAttribute("countStudent")==null)
	  		application.setAttribute("countStudent", 0);
	 %>
	  
	   <li style="border:none">
	   		<table class="tablelist">
	   			<tr><th>在考试卷</th><th>试卷总分</th><th>试题数量</th><th>出题类型</th><th>开考时间</th><th>考试时间(分钟)</th><th>当前在考人数</th><th>操作</th></tr>
	   			<tr><td><%=currentExam.getPaperName() %></td>
		   			<td><%=currentExam.getTotalScore() %></td>
		   			<td><%=currentExam.getQuestionNum() %></td>
		   			<td><%
		   				if(currentExam.getType()==-1){
		   				  out.print("随机出题");
		   				}else{
		   				  out.print("顺序出题");
		   				}
		   			 %></td>
		   			<td><%=Tools.formatDate(currentExam.getCtime()) %></td>
		   			<td><%=currentExam.getTestTime() %></td>
		   			<td><%=application.getAttribute("countStudent") %></td>
		   			<td><a href="paper-testFinished.action?id=<%=currentExam.getId() %>" style="color:blue;" class="click"> [ 结束考试 ] </a></td>
	   			</tr>
	   		</table>
	   </li>
	
	<%} %>
	</ul>

	<%

	float fFreeMemory=(float)Runtime.getRuntime().freeMemory();
	float fTotalMemory=(float)Runtime.getRuntime().totalMemory();
	float fUsedMemory = fTotalMemory - fFreeMemory;
	float fPercent=fFreeMemory/fTotalMemory*100;
	%>
	<h3>系统状态</h3>
	<ul class="ilist">
		<li>服务器名：<%= request.getServerName() %>  [<%=request.getRemoteAddr()%>]</li>
		<li>
			内存消耗：<%=fUsedMemory/1024/1024%>M / <%=fTotalMemory/1024/1024%>M 
			<div style="width:200px; height:10px; background:#f00; font-size:1px">
				<div style="float:right; background:#0f0; width:<%=(int)(fPercent*2)%>px; font-size:1px; height:10px"></div>
			</div>
		</li>
		<li>操作系统：<%=System.getProperty("os.name") %></li>
		<li>JDK版本：<%=System.getProperty("java.version") %></li>
	</ul>
	
	
	<h3>版本信息</h3>
	<ul class="ilist">
		<li>在线考试管理系统 v1.2</li>
		<li>Email:354867750@qq.com</li>
		<li>Tel:15617888360</li>
	</ul>
	
	<h3>版权信息</h3>
	<ul class="ilist">
		<li>Copyright © 2015-2016</li>
		<li>${SYS_SETTING.copyright }</li>
	</ul>
	
    <div class="tip">
    	<div class="tiptop"><span>提示信息</span><a></a></div>
        
      <div class="tipinfo">
        <span><img src="images/ticon.png" /></span>
        <div class="tipright">
        <p>确定要结束考试么 ？</p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
        </div>
        </div>
        
        <div class="tipbtn">
        <input type="button"  class="sure" value="确定" />&nbsp;
        <input type="button"  class="cancel" value="取消" />
        </div>
    
    </div>
   
    </div>
    
 
</body>
</html>
